<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">

    <title>${systemName}</title>
    <meta name="description" content="${systemName}">
    <meta name="author" content="stylefeng">

    <link rel="stylesheet" href="${ctxPath}/assets/common/layui/css/layui.css"/>
    <link href="${ctxPath}/assets/expand/plugins/ztree/zTreeStyle.css" rel="stylesheet" type="text/css"/>
    <style type="text/css">
        #levelForm{
            margin-top: 20px;
        }
    </style>
</head>

<body>
<div class="layui-container">

    <div class="layui-form-item" style="margin-top: 30px">
        <label class="layui-form-label">部门<span style="color: red;">*</span></label>
        <div class="layui-input-block">
            <select name="dept" id="dept" lay-verify="required" style="height: 35px;width: 150px;">

            </select>
        </div>
    </div>

    <div class="layui-form-item text-center" style="margin-top: 130px; margin-left: 150px;">
        <button class="layui-btn" id="btnSubmit">导出</button>
        <button class="layui-btn layui-btn-primary" type="button" ew-event="closeDialog" id="backupPage">返回</button>
    </div>

</div>

@/* 加入contextPath属性和session超时的配置 */
<script type="text/javascript">
    var Feng = {
        ctxPath: "",
        addCtx: function (ctx) {
            if (this.ctxPath === "") {
                this.ctxPath = ctx;
            }
        }
    };
    Feng.addCtx("${ctxPath}");
</script>
<script type="text/javascript" src="${ctxPath}/assets/common/layui/layui.js"></script>
<script type="text/javascript" src="${ctxPath}/assets/common/js/common.js"></script>

<!--其他插件js-->
<script type="text/javascript" src="${ctxPath}/assets/expand/plugins/jquery/jquery-3.2.1.min.js"></script>
<script type="text/javascript" src="${ctxPath}/assets/expand/plugins/ztree/jquery.ztree.all.min.js"></script>


<script>
    layui.use(['ax','admin','form','upload'], function () {
        var $ = layui.$;
        var $ax = layui.ax;
        var admin = layui.admin;
        var form = layui.form;
        var upload = layui.upload;

        //获取部门option
        var deptList = [];
        var deptAjax = new $ax(Feng.ctxPath + "/dept/selectChildren",function (data) {
            deptList = data;
        }, function (data) {
            Feng.error("获取部门失败！" + data.responseJSON.message)
        });
        deptAjax.start();
        var deptOption = "<option value=''>请选择部门</option>";
        for(var i=0;i<deptList.length;i++){
            deptOption = deptOption + "<option value='"+deptList[i].dept_id+"'>"+deptList[i].simple_name+"</option>";
        }
        $("#dept").append(deptOption);
        form.render('select');


        // 表单提交事件
        $("#btnSubmit").click(function () {
            var dept = $("#dept").val()
            if(dept==null || dept == ''){
                Feng.error("请选择部门")
                return ;
            }
            window.location.href = Feng.ctxPath + "/score/exportScoreByDept?dept="+dept
        })

    })
</script>

</body>

</html>

